<?php


/*
You do not need to modify this script.
*/

// Bring in XML-RPC functionality and client configuration
require ('xmlrpc.php');

class pwIntClient {
	public static $key;
	public static $gameId;
	public static $fault;
	public static $faultCode;
	public static $faultMessage;
	public static $result;

	public static function getFans_v1() {

		// Set parameters for this method call
		$params = array ();
		$params['id'] = self :: $gameId;
		$params['key'] = self :: $key;

		// Execute the request
		self :: execute('pbbgwarp.getFans_v1', $params);

	}

	public static function getFanStatus_v1($inScreenName) {

		// Set parameters for this method call
		$params = array ();
		$params['id'] = self :: $gameId;
		$params['key'] = self :: $key;
		$params['screenname'] = $inScreenName;

		// Execute the request
		self :: execute('pbbgwarp.getFanStatus_v1', $params);

	}

	public static function getNumFans_v1() {

		// Set parameters for this method call
		$params = array ();
		$params['id'] = self :: $gameId;
		$params['key'] = self :: $key;

		// Execute the request
		self :: execute('pbbgwarp.getNumFans_v1', $params);

	}

	public static function getSatelliteStats_v1($inSatellites = array (), $inIp = null) {

		// Set parameters for this method call
		$params = array ();
		$params['id'] = self :: $gameId;
		$params['key'] = self :: $key;
		if (sizeof($inSatellites) > 0)
			$params['satdomains'] = $inSatellites;
		if (!is_null($inIp))
			$params['ip'] = $inIp;

		// Execute the request
		self :: execute('pbbgwarp.getSatelliteStats_v1', $params);

	}

	private static function execute($inMethod, $inParams) {

		$client = new IXR_Client('http://remote.pbbgwarp.com/xmlrpc/server.php');
		$client->timeout = 10;
		if (!$client->query($inMethod, $inParams)) {
			self :: $fault = true;
			self :: $faultCode = $client->getErrorCode();
			self :: $faultMessage = $client->getErrorMessage();
			self :: $result = null;
		} else {
			self :: $fault = false;
			self :: $faultCode = null;
			self :: $faultMessage = null;
			self :: $result = $client->getResponse();
		}

	}

}
?>